<template>
  <div>
    <div class="search">
      <input type="text" class="search__input" :placeholder="placeholder" />
      <div class="search__icon">
        <span>
          <icon-font type="icon-sousuotianchong" />
        </span>
      </div>
    </div>
  </div>
  <div class="test"></div>
</template>

<script lang="ts" setup>
import { reactive, ref } from 'vue'
import { IconFont } from '@/base-ui/Icons/index'
import { IInputSize } from '../type'

const props = withDefaults(
  defineProps<{
    size?: string
    placeholder?: string
  }>(),
  {
    size: "mini",
    placeholder: 'Search...'
  }
)
const placeholder = props.placeholder
const setSizeStyle = (size?: string) => {
  const miniStyle = {
    width: size === 'mini' ? '150px' : '250px',
    height: size === 'mini' ? '35px' : '40px',
    fontSize: size === 'mini' ? '13px' : '15px'
  }
  return miniStyle
}
const styleData = setSizeStyle(props.size)

const { height: th, width: tw, fontSize: fs } = styleData

</script>
<style lang="less" scoped>
/*  SEARCH  */
.search {
  // width: 150px;
  // height: 35px;
  height: v-bind(th);
  display: flex;
  align-items: center;
  margin-left: 500px;
}
.search__input {
  margin-top: 50px;
  margin-left: -10px;
  width: v-bind(tw);
  height: v-bind(th);
  border: none;
  border-radius: 1rem;
  font-size: v-bind(fs);
  text-align: left;
  padding-left: 45px;
  box-shadow: inset 0.2rem 0.2rem 0.5rem @greyLight-2,
    inset -0.2rem -0.2rem 0.5rem @white;
  background: none;
  font-family: inherit;
  color: @greyDark;
}
.search__icon {
  margin: 45px 0 0 -15px;
  width: 20px;
}
.search__input::-moz-placeholder {
  color: @greyLight-3;
}
.search__input:-ms-input-placeholder {
  color: greyLight-3;
}
.search__input::placeholder {
  color: greyLight-3;
}
.search__input:focus {
  outline: none;
  box-shadow: 0.3rem 0.3rem 0.6rem @greyLight-2, -0.2rem -0.2rem 0.5rem @white;
}
.search__input:focus + .search__icon {
  color: @primary;
}
.search__icon {
  height: 2rem;
  position: absolute;
  font-size: 1.5rem;
  padding: 0 1rem;
  display: flex;
  color: @greyDark;
  transition: 0.3s ease;
}
</style>
